package service.Impl;

import dao.Impl.TgoodsDaoImpl;
import dao.TgoodsDao;
import pojo.Tgoods;
import service.TgoodsService;
import util.Page;

import java.util.List;

public class TgoodsServiceImpl implements TgoodsService {
    TgoodsDao tgoodsDao = new TgoodsDaoImpl();


    //获取分页查询数据
    @Override
    public Page selgoods(int id, String name, int dqys) {
        Page page = new Page();
        page.setPageNo(dqys);
        page.setPageCount(tgoodsDao.alls(id, name));
        List<Tgoods> all = tgoodsDao.all(id, name, dqys, page.getPageSize());

        page.setGoods(all);
        return page;
    }

    @Override
    public Tgoods selById(String id) {
        return tgoodsDao.selById(id);
    }

    @Override
    public List<Tgoods> getall() {
        return tgoodsDao.getall();
    }

    @Override
    public int delById(int id) {
        return tgoodsDao.delById(id);
    }

    @Override
    public int addGood(Tgoods tgoods) {
        return tgoodsDao.addGoods(tgoods);
    }


}
